/**
 * 
 */
package com.net.shop.car.manager.api.volley.response;

import org.json.JSONException;
import org.json.JSONObject;

import com.net.shop.car.manager.api.model.Member;
import com.net.shop.car.manager.api.volley.Response;
import com.net.shop.car.manager.utils.Constants;
import com.net.shop.car.manager.utils.LogUtils;
import com.net.shop.car.manager.utils.StringUtils;

/**
 * @author Deve
 *
 */
public class MemberCenterResponse extends Response {
	/**
	 * 
	 */
	private Member member;

	/**
	 * @param type
	 */
	public MemberCenterResponse() {
		super(Constants.MEMBER_CENTER);
	}
	
	@Override
	public String getContentTag() {
		// TODO Auto-generated method stub
		return "memberinfo";
	}
	
	@Override
	public void parseContent(String content) {
		try {
			JSONObject jsonObject = new JSONObject(content);
			member = new Member();
			member.setName(StringUtils.filterNull(jsonObject.getString("NAME")));
			member.setMobile(StringUtils.filterNull(jsonObject.getString("MOBILE")));
			member.setMemberId(StringUtils.filterNull(jsonObject.getString("ID")));
			member.setVb(jsonObject.getInt("VB"));
			member.setPicUrl(StringUtils.filterNull(jsonObject.getString("HEAD_PIC")));
		} catch (JSONException e) {
			LogUtils.e(e.getMessage());
		}
	}

	/**
	 * @return the member
	 */
	public Member getMember() {
		return member;
	}

}
